/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.dscentral.menuPolicies;


import java.util.List;

import org.apache.log4j.Logger;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zkplus.spring.SpringUtil;
import org.zkoss.zul.ListModelList;

import com.poltman.dscentral.db.service.pm.MainMenuLabelsService;


/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * @version $Revision: 1720 $
 * 
 */
public class MenuItemsVM {

	private static Logger log = Logger.getLogger(MenuItemsVM.class);
	
	ListModelList<String> mainMenuLabels = null;
	
    @SuppressWarnings({ "unchecked", "rawtypes" })
	@Init
    public void init() throws Exception {
		if (mainMenuLabels == null) {
	    	MainMenuLabelsService mainMenuLabelsService = (MainMenuLabelsService) SpringUtil.getBean("mainMenuLabelsService");

	    	List<String> items = (List<String>)mainMenuLabelsService.findAllDistinct();
			this.mainMenuLabels = new ListModelList(items);
		}
		
    }

	public ListModelList<String> getMainMenuLabels() throws Exception {
		this.init();
		
		return mainMenuLabels;
	}
}